package com.lmx.repoDomain.tmodel;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

import io.katharsis.resource.annotations.JsonApiIncludeByDefault;
import io.katharsis.resource.annotations.JsonApiResource;
import io.katharsis.resource.annotations.JsonApiToOne;
/**
 * 药物过敏史表
 * @author jing
 *
 */
@JsonApiResource(type = "drugallegy")
@Table(name = "tnb_drug_allegy")
@Entity
public class DrugAllegy extends BaseEntity {

	//private List<Dicttype> drugAllegyType = new ArrayList<Dicttype>();   //药物过敏史的类别
	
	private Dicttype drugAllegyType ;   //药物过敏史的类别
	
	private HealthRecord healthrecord; //对应的健康档案表
	
	private String remark; //备注


	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "health_record_id", foreignKey = @ForeignKey(name = "null"))
	public HealthRecord getHealthrecord() {
		return healthrecord;
	}     

	public void setHealthrecord(HealthRecord healthrecord) {
		this.healthrecord = healthrecord;
	}

	@Column(name="remark")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "drugallegy_type_id", foreignKey = @ForeignKey(name = "null"))
	public Dicttype getDrugAllegyType() {
		return drugAllegyType;
	}

	public void setDrugAllegyType(Dicttype drugAllegyType) {
		this.drugAllegyType = drugAllegyType;
	}

	
}
